from threading import Thread
from werkzeug.local import Local
# vars = '123'
#
local = Local()
local.vars = '123'
class MyThread(Thread):

    def run(self):
        local.vars = 'abc' #修改全局变量要加上 local关键字
        print("子线程:",local.vars)

mythread = MyThread()
mythread.start()
mythread.join() #保证只有子线程运行完了以后才能执行下面的代码

print("主线程:",local.vars)